layui.define(['jquery', 'table'], function (exports) {
    'use strict'

    //layui表格扩展
    var MOD_NAME = 'tableext',
        $ = layui.jquery,
        table = layui.table

    var tableext = new (function () { })()
    //table数据加载
    var tableConfig = {
        limits: [20, 50, 100],
        limit: 20,
        page: true,
        method: "post",
        dataType: 'json',
        contentType: 'application/json',
        autoSort: false,
        skin: 'line',//样式
        defaultToolbar: [//默认工具栏
            // {
            //     layEvent: 'export', icon: 'layui-icon-export',title:"导出"
            // },
            {
                layEvent: 'refresh', icon: 'layui-icon-refresh',title:"刷新"
            },
            'filter',
        ],
        request: {//请求参数
            pageName: 'pageIndex',
            limitName: 'pageSize'
        },
        parseData: function (res) {
            return {
                "count": res.data == null ? 0 : res.data.totalCount,
                'statusCode': res.statusCode,
                'data': res.data.list
            };
        },
        response: {
            statusName: 'statusCode',
            statusCode: 200
        }

    }

    // 全局设置
    table.set(tableConfig);

    exports(MOD_NAME, tableext)
})
